<extend name="Base/common" />
<block name="style">
    <link rel="stylesheet" href="__UNIFY__/css/pages/page_log_reg_v1.css">
</block>

<block name="breadcrumbs">
    <div class="breadcrumbs">
        <div class="container">
            <h1 class="pull-left">用户登陆</h1>
            <ul class="pull-right breadcrumb">
				<li><a href="{:U('Index/index')}">首页</a></li>
                <li class="active">用户登陆</li>
            </ul>
        </div> 
    </div> 
</block>
<block name="body">
    <!--=== Content Part ===-->
    <div class="container content">		
    	<div class="row">
            <div class="col-md-4 col-md-offset-4 col-sm-6 col-sm-offset-3">
                <form class="reg-page" action="__SELF__" method="post">
                    <div class="reg-header">            
                        <h2>登陆账户</h2> 
                        <p>还没有账户？<a href="{:U('User/register')}" class="color-green">立即注册</a></p>
                    </div>


                    <div class="input-group margin-bottom-20">
                        <span class="input-group-addon"><i class="fa fa-user"></i></span>
                        <input type="text" placeholder="用户名" class="form-control" name="username">
                    </div>                    
                    <div class="input-group margin-bottom-20">
                        <span class="input-group-addon"><i class="fa fa-lock"></i></span>
                        <input type="password" placeholder="密码" class="form-control" name="password">
                    </div> 
                    <div class="input-group margin-bottom-20">
                        <span class="input-group-addon"><i class="fa fa-question"></i></span>
                        <input type="text" placeholder="验证码"  name="verify" class="form-control" name="verify">
                    </div>
                    <div class="form-group">
                        <img class="verifyimg reloadverify full-width" alt="点击切换" src="{:U('verify')}" style="cursor:pointer;">
                    </div>
                    <div class="controls Validform_checktip text-warning"></div>
                    <div class="row">
                        <div class="col-md-6 checkbox">
                            <label><input type="checkbox"> 保持登陆</label>                        
                        </div>
                        <div class="col-md-6">
                            <button class="btn-u pull-right" type="submit">登陆</button>                        
                        </div>
                    </div>
                    <hr>
                    <h4>忘记密码 ?</h4>
                    <p>不用担心, <a class="color-green" href="#">点此</a>找回密码.</p>
                </form>            
            </div>
        </div><!--/row-->
    </div><!--/container-->		
    <!--=== End Content Part ===-->
</block>

<block name="script">
	<script type="text/javascript">
	$(document)
		.ajaxStart(function(){
			$("button:submit").addClass("log-in").attr("disabled", true);
		})
		.ajaxStop(function(){
			$("button:submit").removeClass("log-in").attr("disabled", false);
		});
	$("form").submit(function(){
		var self = $(this);
		$.post(self.attr("action"), self.serialize(), success, "json");
		return false;
	
		function success(data){
			if(data.status){
				window.location.href = data.url;
			} else {
				self.find(".Validform_checktip").text(data.info);
				//刷新验证码
				$(".reloadverify").click();
			}
		}
	});
	
	$(function(){
		var verifyimg = $(".verifyimg").attr("src");
	    $(".reloadverify").click(function(){
	        if( verifyimg.indexOf('?')>0){
	            $(".verifyimg").attr("src", verifyimg+'&random='+Math.random());
	        }else{
	            $(".verifyimg").attr("src", verifyimg.replace(/\?.*$/,'')+'?'+Math.random());
	        }
	    });
	});
	</script>
</block>
